// import { validateEdifice } from '@/api/space/fyroomstorey'
import { services } from '@/config'

/* const validateChooseName = (rule, value, callback) => {
  // console.log(rule)
  validateEdifice(value).then(response => {
    const result = response.data.data
    const code = response.data.code
    const msg = response.data.msg
    if (result !== null && code === 1) {
      callback(new Error(msg))
    } else if (code === 1) {
      callback(new Error('你所选的是区域，请选择楼栋信息'))
    } else {
      callback()
    }
  })
} */

export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  searchMenuSpan: 6,
  viewBtn: true,
  addBtn: false,
  editBtn: false,
  delBtn: false,
  column: [
    {
      type: 'tree',
      label: '所属楼栋',
      prop: 'edificeId',
      span: 24,
      hide: true,
      rules: [
        {
          message: '所属楼栋必须填写',
          required: true
        }
      ]
    },
    {
      type: 'input',
      label: '所属楼栋',
      prop: 'edificeName',
      search: true,
      span: 12,
      display: false
    },
    {
      type: 'number',
      label: '开始楼层编号',
      prop: 'start',
      labelWidth: 115,
      span: 12,
      hide: true,
      value: 0
    },
    {
      type: 'number',
      label: '结束楼层编号',
      labelWidth: 115,
      prop: 'end',
      span: 12,
      hide: true,
      value: 0
    },
    {
      type: 'input',
      label: '楼层名称',
      prop: 'name',
      span: 12,
      rules: [{ required: true, message: '楼层名称必须填写' }],
      required: true,
      search: true
    },
    {
      type: 'input',
      label: '楼层编码',
      prop: 'code',
      addDisplay: true,
      editDisabled: true,
      span: 12,
      rules: [{ required: true, message: '楼层编码必须填写' }],
      required: true
    },
    {
      type: 'select',
      label: '入住性别',
      prop: 'checkinGender',
      span: 12,
      cascaderItem: [],
      search: true,
      display: true,
      props: { label: 'label', value: 'value' },
      dicUrl: `${services.adminService}dict/type/gender`,
      dicMethod: 'get',
      required: true,
      rules: [{ required: true, message: '请选择入住性别' }]
    },
    {
      type: 'input',
      label: '排序号',
      prop: 'ordernumber',
      addDisplay: true,
      span: 12,
      hide: true,
      value: '0'
    },
    {
      type: 'textarea',
      label: '备注',
      search: true,
      prop: 'remarks',
      span: 24,
      display: true
    }
  ]
}

export const batchAddsForm = tableOption
